#include "StdAfx.h"
#include "ConsumerSelfModel.h"


ConsumerSelfModel::ConsumerSelfModel(void)
{
	m_id = -1;
	m_consumerID = -1;
	m_companyName = _T("");
	m_companyAddr = -1;
	m_setupTime = -1;
	m_shareRate = -1;
	m_publicBill = -1;
	m_privateBill = -1;
	m_monthTurnover = -1;
	m_duty = -1;
	m_monthRent = -1;
	m_staffNum = -1;
	m_socialSecurityNum = -1;
	m_caseNum = -1;
	m_childSZSchool = -1;
	m_marriage = -1;
	m_industry = -1;
}

ConsumerSelfModel::~ConsumerSelfModel(void)
{
}

ConsumerSelfModel& ConsumerSelfModel::operator=(const ConsumerSelfModel& infoModel)
{
	m_id = infoModel.m_id;
	m_consumerID = infoModel.m_consumerID;
	m_companyName = infoModel.m_companyName;
	m_companyAddr = infoModel.m_companyAddr;
	m_setupTime = infoModel.m_setupTime;
	m_shareRate = infoModel.m_shareRate;
	m_publicBill = infoModel.m_publicBill;
	m_privateBill = infoModel.m_privateBill;
	m_monthTurnover = infoModel.m_monthTurnover;
	m_duty = infoModel.m_duty;
	m_monthRent = infoModel.m_monthRent;
	m_staffNum = infoModel.m_staffNum;
	m_socialSecurityNum = infoModel.m_socialSecurityNum;
	m_caseNum = infoModel.m_caseNum;
	m_childSZSchool = infoModel.m_childSZSchool;
	m_marriage = infoModel.m_marriage;
	m_industry = infoModel.m_industry;

	return *this;
}

void ConsumerSelfModel::parseFromJson(Json::Value& jsonData)
{
	CUtils::getJsonStringField(jsonData, "comName", m_companyName);
	if (!jsonData["comAddr"].isNull()) 
	{
		this->m_companyAddr = jsonData["comAddr"].asInt();
	}
	if (!jsonData["setupTime"].isNull()) 
	{
		this->m_setupTime = jsonData["setupTime"].asInt();
	}
	if (!jsonData["shareRate"].isNull()) 
	{
		this->m_shareRate = jsonData["shareRate"].asInt();
	}
	if (!jsonData["publicTurnOver"].isNull()) 
	{
		this->m_publicBill = jsonData["publicTurnOver"].asInt();
	}
	if (!jsonData["privateTurnOver"].isNull()) 
	{
		this->m_privateBill = jsonData["privateTurnOver"].asInt();
	}
	if (!jsonData["monthTurnOver"].isNull()) 
	{
		this->m_monthTurnover = jsonData["monthTurnOver"].asInt();
	}
	if (!jsonData["position"].isNull()) 
	{
		this->m_duty = jsonData["position"].asInt();
	}
	if (!jsonData["monthRent"].isNull()) 
	{
		this->m_monthRent = jsonData["monthRent"].asInt();
	}
	if (!jsonData["staffNum"].isNull()) 
	{
		this->m_staffNum = jsonData["staffNum"].asInt();
	}
	if (!jsonData["shebaoNum"].isNull()) 
	{
		this->m_socialSecurityNum = jsonData["shebaoNum"].asInt();
	}
	if (!jsonData["caseNum"].isNull()) 
	{
		this->m_caseNum = jsonData["caseNum"].asInt();
	}
	if (!jsonData["childSZSchool"].isNull()) 
	{
		this->m_childSZSchool = jsonData["childSZSchool"].asInt();
	}
	if (!jsonData["marriageStatus"].isNull()) 
	{
		this->m_marriage = jsonData["marriageStatus"].asInt();
	}
	if (!jsonData["industry"].isNull()) 
	{
		this->m_industry = jsonData["industry"].asInt();
	}
}

void ConsumerSelfModel::toJson(Json::Value& jsonData)
{
	if (this->m_companyName.GetLength() > 0) 
	{
		jsonData["comName"] = this->m_companyName.GetBuffer();
	}
	if (this->m_companyAddr >= 0) 
	{
		jsonData["comAddr"] = this->m_companyAddr;
	}
	if (this->m_setupTime >= 0) 
	{
		jsonData["setupTime"] = this->m_setupTime;
	}
	if (this->m_shareRate >= 0) 
	{
		jsonData["shareRate"] = this->m_shareRate;
	}
	if (this->m_publicBill >= 0) 
	{
		jsonData["publicTurnOver"] = this->m_publicBill;
	}
	if (this->m_privateBill >= 0) 
	{
		jsonData["privateTurnOver"] = this->m_privateBill;
	}
	if (this->m_monthTurnover >= 0) 
	{
		jsonData["monthTurnOver"] = this->m_monthTurnover;
	}
	if (this->m_duty >= 0) 
	{
		jsonData["position"] = this->m_duty;
	}
	if (this->m_monthRent >= 0) 
	{
		jsonData["monthRent"] = this->m_monthRent;
	}
	if (this->m_staffNum >= 0) 
	{
		jsonData["staffNum"] = this->m_staffNum;
	}
	if (this->m_socialSecurityNum >= 0) 
	{
		jsonData["shebaoNum"] = this->m_socialSecurityNum;
	}
	if (this->m_caseNum >= 0) 
	{
		jsonData["caseNum"] = this->m_caseNum;
	}
	if (this->m_childSZSchool >= 0) 
	{
		jsonData["childSZSchool"] = this->m_childSZSchool;
	}
	if (this->m_marriage >= 0) 
	{
		jsonData["marriageStatus"] = this->m_marriage;
	}
	if (this->m_industry >= 0) 
	{
		jsonData["industry"] = this->m_industry;
	}
}

